import apiClient from './apiClient'

export const actorService = {
  // 分页获取演员列表
  getActors: async (params = {}) => {
    const { page = 0, size = 10, search } = params
    return await apiClient.get('/actors', {
      params: { page, size, keyword: search }
    })
  },

  // 根据ID获取演员
  getActorById: async (id) => {
    return await apiClient.get(`/actors/${id}`)
  },

  // 创建演员
  createActor: async (actorData) => {
    return await apiClient.post('/actors', actorData)
  },

  // 更新演员
  updateActor: async (id, actorData) => {
    return await apiClient.put(`/actors/${id}`, actorData)
  },

  // 删除演员
  deleteActor: async (id) => {
    return await apiClient.delete(`/actors/${id}`)
  },

  // 搜索演员
  searchActors: async (keyword) => {
    return await apiClient.get('/actors/search', {
      params: { keyword }
    })
  },

  // 批量获取演员
  getActorsByIds: async (actorIds) => {
    return await apiClient.post('/actors/batch', actorIds)
  }
}